package contegor.scire.core.modifications;

import contegor.scire.core.Concept;
import contegor.scire.core.Container;
import contegor.scire.core.DuplicateElementException;
import contegor.scire.core.Id;
import contegor.scire.core.IdFragment;
import contegor.scire.core.Modifiable;

/**
 * {@link Modification} used to notify a {@link Modifiable} that it must create inside itself a {@link Concept}.
 *
 * @version $Revision$
 * @author  Héctor Cirbián Pousa ($Author$)
 */
public class CreateConcept extends BaseCreateConcept<Concept> {
  private static final long serialVersionUID = 2886787493989581794L;

  public CreateConcept(Id targetContainerId, IdFragment conceptId) {
    super(targetContainerId, conceptId);
  }

  public void process(Container container) throws DuplicateElementException {
    assert super.isValidForThisContainer(container);
    this.result = ((Modifiable) container).createConcept(relatedTime, this.taskId.getTransactionId(), conceptId);
    returnPoint.manage(this.taskId, this.result);
  }
}
